#ifndef FONT_LIB_H__
#define FONT_LIB_H__

#include <stdint.h> 


#define FL_HEADER_INFO_OFFSET       (0)
#define FL_SECTION_INF_OFFSET       (0x10)

typedef struct{
    uint32_t    magic;
    uint32_t    size;

    uint8_t     num_of_section;
    uint8_t     height_of_font;
    uint16_t    code_flag;

    // uint8_t     reserved[4];
}fl_header_t; 

typedef struct{
    uint16_t    first;
    uint16_t    last;
    uint32_t    offset; 
}fl_section_inf_t; 

typedef struct{
    uint32_t    offset: 26;
    uint32_t    width:  6; 
}fl_unicode_t; 

typedef struct{
    int initialized; 
    fl_header_t         header;
    fl_section_inf_t    section_inf; 
}font_lib_t; 
typedef struct{
    uint32_t offset: 26;
    uint32_t maxwidth: 6;
}char_desc_data_t; 
typedef struct{
    const fl_header_t *       p_header;
    const fl_section_inf_t*   p_section;

    char_desc_data_t     params;    
}charmap_list_struct_t; 



int font_lib_load_header(fl_header_t * flh,  uint8_t * data, uint16_t size); 

int font_lib_load_section_inf(fl_section_inf_t * flsi, uint8_t *data, uint16_t size);

int font_lib_find_unicode_address(uint16_t unicode, fl_section_inf_t *flsi, uint32_t * p_offset); 

#endif // !FONT_LIB_H__
